//
//  BPAccount.m
//  BeautyPicture
//
//  Created by 沈振邦 on 15/10/26.
//  Copyright (c) 2015年 szb. All rights reserved.
//

#import "BPAccount.h"

@implementation BPAccount

/**
 *  当从文件中解析出一个对象的时候调用
 *  在这个方法中写清楚：怎么解析文件中的数据
 */
- (id)initWithCoder:(NSCoder *)decoder
{
    if (self = [super init]) {
        self.uid = [decoder decodeObjectForKey:@"uid"];
        self.password = [decoder decodeObjectForKey:@"password"];
        self.mobile = [decoder decodeObjectForKey:@"mobile"];
        self.score = [decoder decodeObjectForKey:@"score"];
        self.nickname = [decoder decodeObjectForKey:@"nickName"];
        self.sex = [decoder decodeObjectForKey:@"sex"];
        self.area = [decoder decodeObjectForKey:@"area"];
        self.birthday = [decoder decodeObjectForKey:@"birthday"];
        self.face = [decoder decodeObjectForKey:@"saveface"];
        self.imageData = [decoder decodeObjectForKey:@"imageData"];
    }
    return self;
}

/**
 *  将对象写入文件的时候调用
 *  在这个方法中写清楚：要存储哪些对象的哪些属性，以及怎样存储属性
 */
- (void)encodeWithCoder:(NSCoder *)encoder
{
    [encoder encodeObject:self.uid forKey:@"uid"];
    [encoder encodeObject:self.password forKey:@"password"];
    [encoder encodeObject:self.mobile forKey:@"mobile"];
    [encoder encodeObject:self.score forKey:@"score"];
    [encoder encodeObject:self.nickname forKey:@"nickName"];
    [encoder encodeObject:self.sex forKey:@"sex"];
    [encoder encodeObject:self.area forKey:@"area"];
    [encoder encodeObject:self.birthday forKey:@"birthday"];
    [encoder encodeObject:self.face forKey:@"saveface"];
    [encoder encodeObject:self.imageData forKey:@"imageData"];
}

@end
